package com.tax.plan.utils;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author: TG
 * @Description: About this class
 * @Date :Created in 14:36 2021/5/24 0024
 * @Version : 1.0
 */
public class PdfTest {
    public static void main(String[] args) throws IOException {
        Map<String, String> replaceMap = new HashMap<String, String>(25);
        replaceMap.put("姓名", "天涯");
        replaceMap.put("home", "无声");
        replaceMap.put("身份证", "34353535353535");
        replaceMap.put("年", "2021");
        replaceMap.put("月", "05");
        replaceMap.put("日", "24");
        InputStream ins = Files.newInputStream(Paths.get("./data/自雇者承揽协议（九江万柳科技）1.pdf"));
        ByteArrayOutputStream fill = PdfItextReplaceUtil.fill(ins, replaceMap);
        Files.write(Paths.get("./data/自雇者承揽协议（九江万柳科技2.pdf"), fill.toByteArray());
    }
}
